package com.tedu.egweibo.pojo.dto;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;

@Data
public class UserRegDTO {
    // 参数验证 正则表达式
    @NotBlank(message = "用户名不能为空")
    @Pattern(regexp = "^[\\u4e00-\\u9fa5]{1,30}|[a-zA-Z0-9_]{1,30}$",message = "用户名格式不正确,中文要求1~30个，英文要求1~30个")
    @ApiModelProperty(value = "用户名", required = true,example = "noname")
    private String username;
    @NotBlank(message = "密码不能为空")
    @Pattern(regexp = "^[a-zA-Z0-9_]{6,30}$",message = "密码格式不正确,6~30位")
    @ApiModelProperty(value = "密码", required = true,example = "123456")
    private String password;
    // 要求与用户名相同
    @NotBlank(message = "确认密码不能为空")
    @Pattern(regexp = "^[\\u4e00-\\u9fa5]{1,30}|[a-zA-Z0-9_]{1,30}$",message = "用户昵称格式不正确,中文要求1~30个，英文要求1~30个")
    @ApiModelProperty(value = "昵称", required = true,example = "昵称")
    private String nickname;
}
